<template>
 <div>
    <a-divider orientation="left">基本信息</a-divider>
    &nbsp;&nbsp;职位名称&nbsp; <a-input v-model:value="list.company_name" placeholder="输入职位名称" style="width: 350px" /> <br/><br/>
    &nbsp;&nbsp;招聘状态&nbsp; <a-radio-group v-model:value="list.company_type">  <a-radio value=true>招聘中</a-radio>  <a-radio value=false>已暂停</a-radio>  </a-radio-group><br/><br/>
    &nbsp;&nbsp;审核状态&nbsp; <a-radio-group v-model:value="list.audit_status">  <a-radio value=0>待审核</a-radio>  <a-radio value=1>已通过</a-radio> <a-radio value=2>未通过</a-radio>  </a-radio-group><br/><br/>
    &nbsp;&nbsp;职位性质&nbsp; <a-radio-group v-model:value="list.nature_job">  <a-radio value=true>全职</a-radio>  <a-radio value=false>实习</a-radio>  </a-radio-group><br/><br/>
    &nbsp;&nbsp;职位类别&nbsp; <a-input v-model:value="list.job_category" placeholder="输入职位类别" style="width: 350px" />  <br/><br/>
    &nbsp;&nbsp;学历要求&nbsp; <a-input v-model:value="list.educational_requirements" placeholder="输入学历要求" style="width: 350px" /> <br/><br/>
    &nbsp;&nbsp;工作经验&nbsp; <a-input v-model:value="list.hands_on_background" placeholder="输入工作经验" style="width: 350px" /> <br/><br/>
    &nbsp;&nbsp;招聘人数&nbsp; <a-input v-model:value="list.recruiting_numbers" placeholder="输入招聘人数" style="width: 350px" /> <span style="width: 150px;display: inline-block; "><a-alert style="width: 150px "  message="0表示若干" banner  /></span> <br/><br/>
    &nbsp;&nbsp;新姿待遇&nbsp; <a-input v-model:value="list.pay_low" placeholder="工资低" style="width: 350px"  v-model:disabled="list.discuss_personally" /> -<a-input v-model:value="list.pay_high" v-model:disabled="list.discuss_personally"  placeholder="工资高" style="width: 350px" />  <a-checkbox  v-model:checked="list.discuss_personally">面议</a-checkbox ><br/><br/>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/>

    <a-button @click="saveData()" type="primary">保存</a-button>
 </div>
</template>

<script setup>

import { reactive,onMounted,toRefs} from 'vue'
import { useRoute,useRouter  } from 'vue-router'
const router = useRoute()
const route = useRouter()
let data = reactive({list:{}})

onMounted(()=>{ 
    let datas = JSON.parse(JSON.stringify(router.query))
    // let datas = {...router.query}
    data.list = datas
})

const saveData = async ()=>{
    console.log(data.list.company_type);
    console.log(data.list);
    let d = {
        'id':data.list.id,
        'company_name':data.list.company_name,
        'company_type':Boolean(data.list.company_type == 'true'),
        'audit_status':Number(data.list.audit_status),
        'nature_job':Boolean(data.list.nature_job == 'true'),
        'job_category':data.list.job_category,
        'educational_requirements':data.list.educational_requirements,
        'hands_on_background':data.list.hands_on_background,
        'recruiting_numbers':Number(data.list.recruiting_numbers),
        'pay_low':Number(data.list.pay_low),
        'pay_high':Number(data.list.pay_high),
        'discuss_personally':Boolean(data.list.discuss_personally),
}
    await putJobData(d)
    route.push('/Position_management/position')
}
let {list} = toRefs(data)
</script>

<style lang="scss" scoped>
</style>